package com.untour.im.codec.protocol.handler;

import com.untour.im.codec.protocol.message.body.MessageBody;
import com.untour.im.codec.protocol.packet.client.ResponsePacket;
import com.untour.im.codec.protocol.packet.response.ResponsePacketCodec;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * 消息编码类
 **/
public class ResponseMessageEncoderHandler extends MessageToByteEncoder<ResponsePacket<MessageBody>> {

    @Override
    protected void encode(ChannelHandlerContext ctx, ResponsePacket<MessageBody> packet, ByteBuf out) throws Exception {
        ResponsePacketCodec.INSTANCE.encode(out,packet);
    }

}
